﻿
<!--
    Tento soubor obsahuje vnořený kód x:Code pro styl LinkStyle.
    Z tohoto důvodu musí být Build Action tohoto souboru nastaveno na Page  a musí být uveden atribut x:Class
    Zdrojový kód je pak součástí příslušného vygenerovaného souboru ve složce obj
-->
<ResourceDictionary x:Class="GpxExplorer.Styles"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="Button">
        <Setter Property="Margin" Value="3" />
        <Setter Property="MinWidth" Value="80" />
    </Style>

    <Style TargetType="TextBlock">
        <Setter Property="Margin" Value="3" />
        <Setter Property="TextWrapping" Value="Wrap" />
    </Style>

    <Style TargetType="TextBox">
        <Setter Property="Margin" Value="3" />
    </Style>

    <Style TargetType="Slider">
        <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value}" />
    </Style>

    <Style x:Key="HeaderStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="16" />
        <Setter Property="Background" Value="{StaticResource HighlightBrush}" />
        <Setter Property="FontWeight" Value="Bold" />
    </Style>

    <Style x:Key="SmallWarningStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="10" />
        <Setter Property="Foreground" Value="RosyBrown" />
    </Style>

    <Style x:Key="WarningStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="15" />
        <Setter Property="Background" Value="Orange" />
    </Style>

    <Style x:Key="ErrorStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="15" />
        <Setter Property="Background" Value="Pink" />
    </Style>

    <Style x:Key="GridSplitterStyle" TargetType="GridSplitter">
        <Setter Property="Background" Value="LightBlue" />
    </Style>

    <Style x:Key="HeaderTextBoxStyle" TargetType="TextBox">
        <Setter Property="FontSize" Value="20" />
    </Style>

    <Style x:Key="LinkStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="9" />
        <Setter Property="Foreground" Value="Blue" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="TextDecorations" Value="Underline" />
        <EventSetter Event="MouseDown" Handler="link_MouseDown" />
    </Style>
  <!--Kód na otevření odkazu. Přísluší ke stylu LinkStyle.-->
    <x:Code>
        <![CDATA[
       public void link_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var txb = e.OriginalSource as TextBlock;
            if(string.IsNullOrEmpty(txb.Text))return;
            if (txb != null) System.Diagnostics.Process.Start(txb.Text);
        }
        ]]>
    </x:Code>
</ResourceDictionary>